﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace MegavaniaX.Data.Hardcoded
{

    /// <summary>
    /// A class full of wonderful hardcoded animations.
    /// </summary>
    public static class HardcodedAssets
    {
        /// <summary>
        /// Initializes all graphics, animations, and sounds in a hardcoded, ugly fashion!
        /// </summary>
        public static void InitializeAssets(ContentManager content)
        {
            /** TILES **/
            SpriteManager.AddSprite("megavaniax-metalman-1", new MegavaniaSprite() { width = 16, height = 16, x = 0, y = 0, Texture = content.Load<Texture2D>("megavaniax-metalman-1") }
                );
            SpriteManager.AddSprite("megavaniax-metalman-2", new MegavaniaSprite() { width = 16, height = 16, x = 0, y = 0, Texture = content.Load<Texture2D>("megavaniax-metalman-2") }
                );
            SpriteManager.AddSprite("megavaniax-metalman-3", new MegavaniaSprite() { width = 16, height = 16, x = 0, y = 0, Texture = content.Load<Texture2D>("megavaniax-metalman-3") }
                );
            SpriteManager.AddSprite("megavaniax-metalman-4", new MegavaniaSprite() { width = 16, height = 16, x = 0, y = 0, Texture = content.Load<Texture2D>("megavaniax-metalman-4") }
                );
            /** magnet **/

            string[] magnetSpriteNames = new string[]
            {
                "bg-inside",
                "bg-skyb",
                "bg-skyb2p1",
                "bg-skyb2p2",
                "bg-skyb2p3",
                "bg-skybl",
                "bg-skybl2t1",
                "bg-skybl2t2",
                "bg-skybl2t3",
                "bg-skybl2t4",
                "bg-skybl2t5",
                "bg-skybl2t6",
                "bg-skyp2pr1",
                "bg-skyp2pr2",
                "bg-skyp2pr3",
                "bg-skyp2pr4",
                "bg-skypr",
                "bg-skypr2bl1",
                "bg-skypr2bl2",
                "bg-skypr2bl3",
                "bg-skypr2bl4",
                "bg-skyt",
                "corner1",
                "corner2",
                "corner3",
                "floor1",
                "floor10",
                "floor2",
                "floor3",
                "floor4",
                "floor5",
                "floor6",
                "floor7",
                "floor8",
                "floor9",
                "wall1",
                "wall2",
                "wall3",
                "wall4",
                "wall5"
            };
            foreach (var magnetSpriteName in magnetSpriteNames)
            {
                SpriteManager.AddSprite("levels/magnet/" + magnetSpriteName, new MegavaniaSprite() { width = 16, height = 16, x = 0, y = 0, Texture = content.Load<Texture2D>("levels/magnet/" + magnetSpriteName) }
                    );
            }


            #region Eyeblock
            /** eyeblock **/
            string[] eyeBlockNames = new string[]
            {
                "eyeblock1",
                "eyeblock2",
                "eyeblock3"
            };
            foreach (var eyeBlockName in eyeBlockNames)
            {
                SpriteManager.AddSprite("sprites/enemy/" + eyeBlockName, new MegavaniaSprite() { width = 16, height = 16, x = 0, y = 0, Texture = content.Load<Texture2D>("sprites/enemy/" + eyeBlockName) }
                    );
            }

            {
                Animation eyeBlockIdleAnim = new Animation();
                eyeBlockIdleAnim.AddAnimationEntry(new Animation.AnimationEntry(SpriteManager.GetSprite("sprites/enemy/eyeblock1"), TimeSpan.Zero));
                AnimationManager.RegisterAnimation("eyeblock_idle", eyeBlockIdleAnim);
            }
            {
                Animation eyeBlockStartMoveAnim = new Animation();
                eyeBlockStartMoveAnim.AddAnimationEntry(new Animation.AnimationEntry(SpriteManager.GetSprite("sprites/enemy/eyeblock2"), new TimeSpan(0, 0, 0, 0, 400)));
                eyeBlockStartMoveAnim.AddAnimationEntry(new Animation.AnimationEntry(SpriteManager.GetSprite("sprites/enemy/eyeblock3"), TimeSpan.Zero));
                AnimationManager.RegisterAnimation("eyeblock_startmove", eyeBlockStartMoveAnim);
            }
            {
                Animation eyeBlockEndMoveAnim = new Animation();
                eyeBlockEndMoveAnim.AddAnimationEntry(new Animation.AnimationEntry(SpriteManager.GetSprite("sprites/enemy/eyeblock2"), new TimeSpan(0, 0, 0, 0, 400)));
                eyeBlockEndMoveAnim.AddAnimationEntry(new Animation.AnimationEntry(SpriteManager.GetSprite("sprites/enemy/eyeblock1"), TimeSpan.Zero));
                AnimationManager.RegisterAnimation("eyeblock_endmove", eyeBlockEndMoveAnim);
            }
            #endregion
            #region Megaman
            /** MEGAMAN ACTOR **/
            // Idle
            MegavaniaSprite megamanIdle = new MegavaniaSprite() { width = 21, height = 24, x = 0, y = 0, Texture = content.Load<Texture2D>("megaman_idle") };
            MegavaniaSprite megamanIdle_2 = new MegavaniaSprite() { width = 21, height = 24, x = 0, y = 0, Texture = content.Load<Texture2D>("megaman_idle_2") };
            Animation megamanIdleAnim = new Animation();
            megamanIdleAnim.AddAnimationEntry(new Animation.AnimationEntry(megamanIdle, new TimeSpan(0, 0, 0, 0, 1600)));
            megamanIdleAnim.AddAnimationEntry(new Animation.AnimationEntry(megamanIdle_2, new TimeSpan(0, 0, 0, 0, 200)));
            AnimationManager.RegisterAnimation("player_idle", megamanIdleAnim);


            // Jump right
            MegavaniaSprite megamanJump = new MegavaniaSprite() { width = 26, height = 30, x = 0, y = 0, Texture = content.Load<Texture2D>("sprites/player/jump-right") };
            Animation megamanJumpRightAnim = new Animation();
            megamanJumpRightAnim.AddAnimationEntry(new Animation.AnimationEntry(megamanJump, TimeSpan.Zero));
            AnimationManager.RegisterAnimation("player_jumpright", megamanJumpRightAnim);

            // Slide right
            MegavaniaSprite megamanSlideRight = new MegavaniaSprite() { width = 27, height = 21, x = 0, y = 0, Texture = content.Load<Texture2D>("sprites/player/slide-right"), offsetY = 0 };
            Animation megamanSlideRightAnim = new Animation();
            megamanSlideRightAnim.AddAnimationEntry(new Animation.AnimationEntry(megamanSlideRight, TimeSpan.Zero));
            AnimationManager.RegisterAnimation("player_slideright", megamanSlideRightAnim);


            // Shoot (idle)
            MegavaniaSprite megamanShootIdle = new MegavaniaSprite() { width = 31, height = 24, x = 0, y = 0, Texture = content.Load<Texture2D>("sprites/player/shootidleright") };
            Animation megamanShootIdleAnim = new Animation(null, false);
            megamanShootIdleAnim.AddAnimationEntry(new Animation.AnimationEntry(megamanShootIdle, new TimeSpan(0, 0, 0, 0, 450)));
            AnimationManager.RegisterAnimation("player_shootidle", megamanShootIdleAnim);

            // Shoot (move)
            MegavaniaSprite megamanShootMove1 = new MegavaniaSprite() { width = 29, height = 22, x = 0, y = 0, Texture = content.Load<Texture2D>("sprites/player/shootmoveright1") };
            MegavaniaSprite megamanShootMove2 = new MegavaniaSprite() { width = 26, height = 24, x = 0, y = 0, Texture = content.Load<Texture2D>("sprites/player/shootmoveright2") };
            MegavaniaSprite megamanShootMove3 = new MegavaniaSprite() { width = 30, height = 22, x = 0, y = 0, Texture = content.Load<Texture2D>("sprites/player/shootmoveright3") };
            Animation megamanShootMoveAnim = new Animation(null, false);
            megamanShootMoveAnim.AddAnimationEntry(new Animation.AnimationEntry(megamanShootMove1, new TimeSpan(0, 0, 0, 0, 150)));
            megamanShootMoveAnim.AddAnimationEntry(new Animation.AnimationEntry(megamanShootMove2, new TimeSpan(0, 0, 0, 0, 150)));
            megamanShootMoveAnim.AddAnimationEntry(new Animation.AnimationEntry(megamanShootMove3, new TimeSpan(0, 0, 0, 0, 150)));
            AnimationManager.RegisterAnimation("player_shootmove", megamanShootMoveAnim);

            // Shoot (jump)
            MegavaniaSprite megamanShootJump = new MegavaniaSprite() { width = 29, height = 30, x = 0, y = 0, Texture = content.Load<Texture2D>("sprites/player/shootjumpright") };
            Animation megamanShootJumpAnim = new Animation(null, false);
            megamanShootJumpAnim.AddAnimationEntry(new Animation.AnimationEntry(megamanShootJump, new TimeSpan(0, 0, 0, 0, 450)));
            AnimationManager.RegisterAnimation("player_shootjump", megamanShootJumpAnim);

            // Move right
            MegavaniaSprite megaman_right_1 = new MegavaniaSprite() { width = 24, height = 22, x = 0, y = 0, Texture = content.Load<Texture2D>("megaman_moveright_1") };
            MegavaniaSprite megaman_right_2 = new MegavaniaSprite() { width = 24, height = 22, x = 0, y = 0, Texture = content.Load<Texture2D>("megaman_moveright_2") };
            MegavaniaSprite megaman_right_3 = new MegavaniaSprite() { width = 24, height = 22, x = 0, y = 0, Texture = content.Load<Texture2D>("megaman_moveright_3") };
            Animation megamanMoveRightAnim = new Animation();
            megamanMoveRightAnim.AddAnimationEntry(new Animation.AnimationEntry(megaman_right_1, new TimeSpan(0, 0, 0, 0, 150)));
            megamanMoveRightAnim.AddAnimationEntry(new Animation.AnimationEntry(megaman_right_2, new TimeSpan(0, 0, 0, 0, 150)));
            megamanMoveRightAnim.AddAnimationEntry(new Animation.AnimationEntry(megaman_right_3, new TimeSpan(0, 0, 0, 0, 150)));
            megamanMoveRightAnim.AddAnimationEntry(new Animation.AnimationEntry(megaman_right_2, new TimeSpan(0, 0, 0, 0, 150)));
            AnimationManager.RegisterAnimation("player_moveright", megamanMoveRightAnim);

            // Climb
            MegavaniaSprite megaman_climb1 = new MegavaniaSprite() { width = 16, height = 29, x = 0, y = 0, Texture = content.Load<Texture2D>("sprites/player/climb1"), offsetX = -3 };
            MegavaniaSprite megaman_climb2 = new MegavaniaSprite() { width = 16, height = 29, x = 0, y = 0, Texture = content.Load<Texture2D>("sprites/player/climb2"), offsetX = -3 };
            Animation megamanclimb = new Animation();
            megamanclimb.AddAnimationEntry(new Animation.AnimationEntry(megaman_climb1, new TimeSpan(0, 0, 0, 0, 300)));
            megamanclimb.AddAnimationEntry(new Animation.AnimationEntry(megaman_climb2, new TimeSpan(0, 0, 0, 0, 300)));
            AnimationManager.RegisterAnimation("player_climb", megamanclimb);

            #endregion


            #region Weapons
            /** BULLET **/
            MegavaniaSprite bullet = new MegavaniaSprite() { width = 8, height = 6, x = 0, y = 0, Texture = content.Load<Texture2D>("sprites/weapons/bullet") };
            Animation bulletAnim = new Animation();
            bulletAnim.AddAnimationEntry(new Animation.AnimationEntry(bullet, TimeSpan.Zero));
            AnimationManager.RegisterAnimation("bullet", bulletAnim);

            /** MAGNET **/
            MegavaniaSprite magnet = new MegavaniaSprite() { width = 16, height = 12, x = 0, y = 0, Texture = content.Load<Texture2D>("sprites/weapons/magnetright") };
            Animation magnetAnim = new Animation();
            magnetAnim.AddAnimationEntry(new Animation.AnimationEntry(magnet, TimeSpan.Zero));
            AnimationManager.RegisterAnimation("magnet", magnetAnim);
            #endregion
        }

    }
}
